import { useLocation } from 'react-router-dom';

import { KeepAliveRouteOutlet, useKeepaliveRef } from 'keepalive-for-react';
import { observer } from 'mobx-react-lite';

import { useLayoutStore } from '@/store/layout';

const KeepAliveOutlet: React.FC = () => {
  const aliveRef = useKeepaliveRef();
  const location = useLocation();
  // const outlet = useOutlet();
  const layoutStore = useLayoutStore();

  return (
    <KeepAliveRouteOutlet
      include={[]}
      transition
      aliveRef={aliveRef}
      // cache={layoutStore.matchRoute?.keepAlive ?? false}
      // activeName={location.pathname}
      max={40}
    />
  );
};

export default observer(KeepAliveOutlet);
